//声明一个常量存储token的key

const HMKEY = 'hm-toutiao'

//1.存token
function saveToken(obj) {
  localStorage.setItem(HMKEY, JSON.stringify(obj))
}

//2.取token
function getToken() {
  return JSON.parse(localStorage.getItem(HMKEY))
}

//3.删除token
function removeToken() {
  localStorage.removeItem(HMKEY)
}

//导出接口
export {
  saveToken,
  getToken,
  removeToken
}
